package com.jfinal.ext.ueditor.result;

import org.jetbrains.annotations.NotNull;

/**
 * @author Timor
 * @version 1.0
 * @date 2023/01/04 16:51:58
 */
public class CatchImageResult {
    private final String state;
    private String url;
    private String source;
    private String message;

    private CatchImageResult(boolean success) {
        this.state = success ? RetResult.STATE_SUCCESS : RetResult.STATE_FAILURE;
    }

    public CatchImageResult(@NotNull String url, @NotNull String source) {
        this(true);

        this.url = url;
        this.source = source;
    }

    public CatchImageResult(@NotNull String errorMessage) {
        this(false);

        this.message = errorMessage;
    }


    public String getUrl() {
        return url;
    }

    public String getSource() {
        return source;
    }

    public String getState() {
        return state;
    }

    public String getMessage() {
        return message;
    }
}
